package com.stu.test;

import com.stu.common.utils.DataInsertUtil;
import com.stu.entity.Student;
import com.stu.mapper.StudentMapper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.test.context.SpringBootTest;

import java.time.LocalDateTime;
import java.util.Date;

@SpringBootTest

public class demo {

    @Autowired
    StudentMapper studentMapper;

    @Test
    public void test() {
        Student student=new Student();
        int sno=10001;
        for (int i = 1; i < 1000; i++) {
            student.setId(i);
            student.setSno(sno);
            student.setPassWord(String.valueOf(sno));
            student.setName(DataInsertUtil.GenerateName().get("son"));
            student.setUid(String.valueOf(DataInsertUtil.GenerateUid().get("uid")));
            student.setSex("男");
            student.setAge(20);
            student.setBirth(LocalDateTime.now());
            student.setPnum(DataInsertUtil.GeneratePhone());
            student.setStime(LocalDateTime.now());
            student.setFname(DataInsertUtil.GenerateName().get("father"));
            student.setFpnum(DataInsertUtil.GeneratePhone());
            student.setMname(DataInsertUtil.GenerateName().get("mother"));
            student.setMpnum(DataInsertUtil.GeneratePhone());
            student.setAddress(DataInsertUtil.GenerateAddress());
            student.setCno(sno);
            student.setTno(sno);
            student.setMno(sno);
            sno++;

            studentMapper.insert(student);
        }

    }
}
